/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.customer.manage.repository.mapper;

import info.peigen.hotpot.business.customer.core.repository.entity.CustomerOperatorEntity;
import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlManageMapper;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

/**
 * <b>(CustomerOperatorManageMapper)</b>
 * 管理后台 "客户操作员" 数据库映射服务
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023-09-08
 */
@SuppressWarnings("unused")
public interface CustomerOperatorManageMapper extends AbstractBeetlSqlManageMapper<CustomerOperatorEntity> {

    // 唯一索引[operator_id]
    @Sql("select * from customer_operator where operator_id = ?")
    @Select
    CustomerOperatorEntity findByOperatorId(String operatorId);

    @Sql("select * from customer_operator where operator_id = ? for update")
    @Select
    CustomerOperatorEntity lockByOperatorId(String operatorId);

    @Sql("delete from customer_operator where operator_id = ?")
    @Update
    void deleteByOperatorId(String operatorId);

    // 索引[customer_id]
    @Sql("select * from customer_operator where customer_id = ?")
    @Select
    CustomerOperatorEntity findByCustomerId(String customerId);

    @Sql("delete from customer_operator where customer_id = ?")
    @Update
    void deleteByCustomerId(String customerId);

    // 唯一索引[login_name]
    @Sql("select * from customer_operator where login_name = ?")
    @Select
    CustomerOperatorEntity findByLoginName(String loginName);

    @Sql("select * from customer_operator where login_name = ? for update")
    @Select
    CustomerOperatorEntity lockByLoginName(String loginName);

    @Sql("delete from customer_operator where login_name = ?")
    @Update
    void deleteByLoginName(String loginName);

    // 索引[status]
    @Sql("select * from customer_operator where status = ?")
    @Select
    CustomerOperatorEntity findByStatus(String status);

    @Sql("delete from customer_operator where status = ?")
    @Update
    void deleteByStatus(String status);

    // 索引[delete_flag]
    @Sql("select * from customer_operator where delete_flag = ?")
    @Select
    CustomerOperatorEntity findByDeleteFlag(String deleteFlag);

    @Sql("delete from customer_operator where delete_flag = ?")
    @Update
    void deleteByDeleteFlag(String deleteFlag);

    // 索引[partner_id]
    @Sql("select * from customer_operator where partner_id = ?")
    @Select
    CustomerOperatorEntity findByPartnerId(String partnerId);

    @Sql("delete from customer_operator where partner_id = ?")
    @Update
    void deleteByPartnerId(String partnerId);
}